package cn.wit.test;

/**
 * 编写一个方法，求矩阵中某一列元素之和：
 * 
 * @author 16604
 *
 */

public class DemoMatrixElementSum {
	public static void main(String[] args) {

		double[][] a = { { 1.5, 2, 3, 4 }, { 2.3, 5, 8, 9 }, { 3, 5.4, 7, 10 } };
		

		System.out.println(sumColumn(a,0));


	}

	public static double sumColumn(double[][] matrix, int column) {
	
		double count=0;
		for(int i =0;i<matrix.length;i++) {
			count = count +matrix[i][column];
		}
		return count;
	}

}
